package com.miracle9.game.dao;
import com.miracle9.game.entity.UserShutup;
import java.util.List;
import org.hibernate.Query;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Repository;

@Repository
public class UserShutupServiceDao extends SqlOperating<UserShutup, Integer>
{
  @Caching(evict={@org.springframework.cache.annotation.CacheEvict(value={"springCache"}, key="'getShutup'+#userId"), @org.springframework.cache.annotation.CacheEvict(value={"springCache"}, key="'getAllUserShutup'")})
  public void deleteByUid(int userId)
  {
	  q_CreateSql("delete from UserShutup where userId=?", new Object[] { Integer.valueOf(userId) }).executeUpdate();
  }
  
  @Cacheable(value={"springCache"}, key="'getShutup'+#userId")
  public UserShutup getByUid(int userId)
  {
    return (UserShutup)q_CreateSqlFilter("from UserShutup where userId=?", new Object[] { Integer.valueOf(userId) });
  }
  
  @Cacheable(value={"springCache"}, key="'getAllUserShutup'")
  public List<UserShutup> getAllUserShutup()
  {
    return q_CreateSqlList("from UserShutup", new Object[0]);
  }
}